<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Create a Directory 
 *
 * Reads the specified directory and builds an array
 * representation of it.  Sub-folders contained with the
 * directory will be mapped as well.
 *
 * @access	public
 * @param	string	path to source
 * @param	int		depth of directories to traverse (0 = fully recursive, 1 = current dir, etc)
 * @return	array
 */
if ( ! function_exists('create_folder'))
{
    function create_folder($path) {
        $arr = explode('/', $path);
        $folder_name = null;
        foreach ($arr as $val) {
            $folder_name .= $val . '/';
            if (!is_dir($folder_name)) {
                $oldumask = umask(0);
                mkdir($folder_name, 0777, true);
                umask($oldumask);
            }
        }
        return $folder_name;
    }
}


/* End of file My_directory_helper.php */
/* Location: ./application/helpers/MY_directory_helper.php */